package com.sanshengshui.iot.util;

import java.util.ArrayList;
import java.util.List;

public class KafkaMockUtil {


    private static final int MAX = 500;

    private final static List<String> msgList = new ArrayList<>();


    public synchronized static void addMsg(String str){
        if(msgList.size() > MAX){
            msgList.clear();
        }
        msgList.add(str);
    }

    public synchronized static List<String> getAllMsg(){
        List<String> msgListTmp = new ArrayList<>();
        msgListTmp.addAll(msgList);
        return msgListTmp;
    }

}
